--[[
副本回调相关逻辑
接口列表：
onRoomBegin			副本房间开始
onRoomFinish		副本房间完成
onRoomFinish2		副本房间完成清除副本内对象后
onRoomClear			副本房间清除
onHumanBeginCopy	玩家开始副本
onHumanEndCopy		玩家结束副本
onHumanEnterCopyScene	玩家进入副本场景回调
onHumanLeaveCopyScene	玩家离开副本场景回调
onMonsterDieCB		怪物被打死回调
onCollectDieCB		采集物被采集回调
onRoleDieCB			玩家被打死回调
onPickUpItemCB		拾取道具回调
onTimerTenSec		定时器回调 10秒一次
onTimerOneSec		定时器回调 1秒一次
onRoleOffline		玩家掉线
onSceneNChange		地图事件里面的n计数器变化
onSkillKillCnt		一招击杀个数回调
onGetLeftTime		获取副本剩余时间
onGetFinishReward	获取副本通关奖励 返回值是一个table {exp, yinliang, grids}
onRoleBeHitCB	    玩家攻击回调
onMonsterBeHitCB    怪物被攻击回调
onActionAddExp		地图事件加经验回调
onCheckEnterCondition  检查进入条件
--]]

local Msg = require("core.Msg")
local CopyExcel = require("excel.Map").copy
local Copy = require("copy.CopyL")
local CopyDefine = require("copy.Define")
local Aim = require("copy.Aim")
local Pata = require("copy.Pata")
local TD   = require("copy.TD")
local JZWar = require("copy.JZWar")
local FamilyWar = require("copy.FamilyWar")
local WSSL = require("copy.WSSL")
local OfflinePK = require("copy.OfflinePK")
local Dati = require("copy.Dati")
local FamilyOnHook = require("copy.FamilyOnHook")
local WorldBossFL = require("worldboss.WorldBossLogicL")
local GMTX = require("copy.GMTX")
local HorseFight = require("copy.HorseFight")
local CopyFast = require("activity.operate.CopyFast")
local ActivityPlay = require("activity.operate.ActivityPlay")
local ComplexActivityPlay = require("activity.complex.ActivityPlay")
local ComplexCopyFast = require("activity.complex.CopyFast")
local DHFight = require("copy.DHFight")
local TD2 = require("copy.TD2")
local CCJJWar = require("copy.CCJJWar")
local OfficialLogic = require("official.OfficialLogic")

extendTable = extendTable or {
    onDoAimFinish = {},
    onRoomBegin = {},
    onRoomFinish = {},
    onRoomFinish2 = {},
    onRoomClear = {},
    onHumanBeginCopy = {},
    onHumanEndCopy = {},
    onHumanEnterCopyScene = {},
    onHumanLeaveCopyScene = {},
    onMonsterDieCB = {},
    onCollectDieCB = {},
    onRoleDieCB = {},
    onPickUpItemCB = {},
    onTimerTenSec = {},
    onTimerOneSec = {},
    onRoleOffline = {},
    onSceneNChange = {},
    onSkillKillCnt = {},
    onGetLeftTime = {},
    onGetFinishReward = {},
    onRoleBeHitCB = {},
    onMonsterBeHitCB = {},
    onActionAddExp = {},
    onCheckEnterCondition = {},
}

function init()
    -- 爬塔相关回调 begin
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_PATA_1_ID] = Pata.onPataHumanEnterCopyScene
    extendTable.onDoAimFinish[CopyDefine.COPY_PATA_1_ID] = Pata.onPataAimFinish
    extendTable.onTimerOneSec[CopyDefine.COPY_PATA_1_ID] = Pata.onPataOneSec
    extendTable.onRoomClear[CopyDefine.COPY_PATA_1_ID] = Pata.onPataClear
    extendTable.onRoomFinish[CopyDefine.COPY_PATA_1_ID] = Pata.onPataRoomFinish
    extendTable.onMonsterDieCB[CopyDefine.COPY_PATA_1_ID] = Pata.onPataMonsterDie
    extendTable.onRoleDieCB[CopyDefine.COPY_PATA_1_ID] = Pata.onPataRoleDie
    -- 爬塔相关回调 end

    -- td相关扩展回调 begin
    extendTable.onRoomBegin[CopyDefine.COPY_TD_ID1] = TD.onTDRoomBegin
    extendTable.onRoomClear[CopyDefine.COPY_TD_ID1] = TD.onTDRoomClear
    extendTable.onHumanBeginCopy[CopyDefine.COPY_TD_ID1] = TD.onTDHumanBeginCopy
    extendTable.onMonsterDieCB[CopyDefine.COPY_TD_ID1] = TD.onTDMonsterDie
    extendTable.onRoleDieCB[CopyDefine.COPY_TD_ID1] = TD.onTDRoleDieCB
    extendTable.onTimerTenSec[CopyDefine.COPY_TD_ID1] = TD.onTDTimer
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_TD_ID1] = TD.onTDHumanEnterCopyScene
    extendTable.onRoomBegin[CopyDefine.COPY_TD_ID2] = TD.onTDRoomBegin
    extendTable.onRoomClear[CopyDefine.COPY_TD_ID2] = TD.onTDRoomClear
    extendTable.onHumanBeginCopy[CopyDefine.COPY_TD_ID2] = TD.onTDHumanBeginCopy
    extendTable.onMonsterDieCB[CopyDefine.COPY_TD_ID2] = TD.onTDMonsterDie
    extendTable.onRoleDieCB[CopyDefine.COPY_TD_ID2] = TD.onTDRoleDieCB
    extendTable.onTimerTenSec[CopyDefine.COPY_TD_ID2] = TD.onTDTimer
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_TD_ID2] = TD.onTDHumanEnterCopyScene
    extendTable.onRoomBegin[CopyDefine.COPY_TD_ID3] = TD.onTDRoomBegin
    extendTable.onRoomClear[CopyDefine.COPY_TD_ID3] = TD.onTDRoomClear
    extendTable.onHumanBeginCopy[CopyDefine.COPY_TD_ID3] = TD.onTDHumanBeginCopy
    extendTable.onMonsterDieCB[CopyDefine.COPY_TD_ID3] = TD.onTDMonsterDie
    extendTable.onRoleDieCB[CopyDefine.COPY_TD_ID3] = TD.onTDRoleDieCB
    extendTable.onTimerTenSec[CopyDefine.COPY_TD_ID3] = TD.onTDTimer
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_TD_ID3] = TD.onTDHumanEnterCopyScene
    -- td相关扩展回调 end

    -- 武圣试炼活动回调 begin
    extendTable.onRoomBegin[CopyDefine.COPY_WSSL_ID] = WSSL.onWSSLRoomBegin
    extendTable.onRoomClear[CopyDefine.COPY_WSSL_ID] = WSSL.onWSSLRoomClear
    extendTable.onMonsterDieCB[CopyDefine.COPY_WSSL_ID] = WSSL.onWSSLMonsterDie
    extendTable.onTimerTenSec[CopyDefine.COPY_WSSL_ID] = WSSL.onWSSLTimerTenSec
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_WSSL_ID] = WSSL.onWSSLHumanEnterCopyScene
    extendTable.onCheckEnterCondition[CopyDefine.COPY_WSSL_ID] = WSSL.checkEnter
    extendTable.onPickUpItemCB[CopyDefine.COPY_WSSL_ID] = WSSL.onWSSLPickUpItem
    extendTable.onGetLeftTime[CopyDefine.COPY_WSSL_ID] = WSSL.getLeftTime
    -- 武圣试炼活动回调 end

    -- 荆州争夺战
    extendTable.onCheckEnterCondition[CopyDefine.COPY_JZWAR_ID] = JZWar.checkEnter
    extendTable.onHumanBeginCopy[CopyDefine.COPY_JZWAR_ID] = JZWar.onJZWarHumanBeginCopy
    extendTable.onHumanEndCopy[CopyDefine.COPY_JZWAR_ID] = JZWar.onJZWarHumanEndCopy
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_JZWAR_ID] = JZWar.onJZWarHumanEnterCopy
    extendTable.onHumanLeaveCopyScene[CopyDefine.COPY_JZWAR_ID] = JZWar.onJZWarHumanLeaveCopy
    extendTable.onTimerTenSec[CopyDefine.COPY_JZWAR_ID] = JZWar.onJZWarTimer
    extendTable.onTimerOneSec[CopyDefine.COPY_JZWAR_ID] = JZWar.onJZWarOneSec
    extendTable.onRoomBegin[CopyDefine.COPY_JZWAR_ID] = JZWar.onJZWarRoomBegin
    extendTable.onMonsterDieCB[CopyDefine.COPY_JZWAR_ID] = JZWar.onJZWarMonsterDie
    extendTable.onRoleDieCB[CopyDefine.COPY_JZWAR_ID] = JZWar.onJZWarRoleDieCB
    extendTable.onRoomClear[CopyDefine.COPY_JZWAR_ID] = JZWar.onJZWarRoomClear
    extendTable.onRoomFinish[CopyDefine.COPY_JZWAR_ID] = JZWar.onJZWarRoomFinish
    extendTable.onCollectDieCB[CopyDefine.COPY_JZWAR_ID] = JZWar.onCollectDieCB
    extendTable.onRoleBeHitCB[CopyDefine.COPY_JZWAR_ID] = JZWar.onJZWarRoleBeHit
	
	--竞技场
    extendTable.onMonsterDieCB[CopyDefine.COPY_OFFLINE_PK_ID] = OfflinePK.onMonsterDie
    extendTable.onRoleDieCB[CopyDefine.COPY_OFFLINE_PK_ID] = OfflinePK.onRoleDieCB
    extendTable.onRoomClear[CopyDefine.COPY_OFFLINE_PK_ID] = OfflinePK.onRoomClear
    extendTable.onRoomFinish[CopyDefine.COPY_OFFLINE_PK_ID] = OfflinePK.onRoomFinish
    extendTable.onHumanEndCopy[CopyDefine.COPY_OFFLINE_PK_ID] = OfflinePK.onHumanEndCopy
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_OFFLINE_PK_ID] = OfflinePK.onHumanEnterCopy
    
    --答题活动
    extendTable.onTimerOneSec[CopyDefine.COPY_DATI_ID] = Dati.onDatiOneSec
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_DATI_ID] = Dati.onDatiHumanEnterCopy
    extendTable.onHumanLeaveCopyScene[CopyDefine.COPY_DATI_ID] = Dati.onDatiHumanLeaveCopy
    extendTable.onRoomBegin[CopyDefine.COPY_DATI_ID] = Dati.onDatiRoomBegin
    extendTable.onCheckEnterCondition[CopyDefine.COPY_DATI_ID] = Dati.checkEnter

    --军团挂机
    extendTable.onCheckEnterCondition[CopyDefine.COPY_FAMILY_ONHOOK_ID] = FamilyOnHook.checkEnter
    extendTable.onHumanBeginCopy[CopyDefine.COPY_FAMILY_ONHOOK_ID] = FamilyOnHook.onFamilyOnHookHumanBeginCopy
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_FAMILY_ONHOOK_ID] = FamilyOnHook.onFamilyOnHookHumanEnterCopy
    extendTable.onHumanLeaveCopyScene[CopyDefine.COPY_FAMILY_ONHOOK_ID] = FamilyOnHook.onFamilyOnHookHumanLeaveCopy
    extendTable.onTimerTenSec[CopyDefine.COPY_FAMILY_ONHOOK_ID] = FamilyOnHook.onFamilyOnHookTimer
    extendTable.onTimerOneSec[CopyDefine.COPY_FAMILY_ONHOOK_ID] = FamilyOnHook.onFamilyOnHookOneSec
    extendTable.onRoomBegin[CopyDefine.COPY_FAMILY_ONHOOK_ID] = FamilyOnHook.onFamilyOnHookRoomBegin
    extendTable.onMonsterDieCB[CopyDefine.COPY_FAMILY_ONHOOK_ID] = FamilyOnHook.onFamilyOnHookMonsterDie
    extendTable.onRoleDieCB[CopyDefine.COPY_FAMILY_ONHOOK_ID] = FamilyOnHook.onFamilyOnHookRoleDieCB
    extendTable.onRoomClear[CopyDefine.COPY_FAMILY_ONHOOK_ID] = FamilyOnHook.onFamilyOnHookRoomClear
    extendTable.onCollectDieCB[CopyDefine.COPY_FAMILY_ONHOOK_ID] = FamilyOnHook.onCollectDieCB
    extendTable.onRoleBeHitCB[CopyDefine.COPY_FAMILY_ONHOOK_ID] = FamilyOnHook.onFamilyOnHookRoleBeHit
    
    --世界BOSS
    extendTable.onCheckEnterCondition[CopyDefine.COPY_WORLDBOSS] = WorldBossFL.checkEnter
    extendTable.onRoomBegin[CopyDefine.COPY_WORLDBOSS] = WorldBossFL.onWorldBossRoomBegin
    extendTable.onRoomClear[CopyDefine.COPY_WORLDBOSS] = WorldBossFL.onWorldBossRoomClear
    extendTable.onMonsterBeHitCB[CopyDefine.COPY_WORLDBOSS] = WorldBossFL.onWorldBossMonsterBeHit

    --古墓探险
    extendTable.onCheckEnterCondition[CopyDefine.COPY_GMTX_COPY_ID] = GMTX.checkEnter
    extendTable.onRoomBegin[CopyDefine.COPY_GMTX_COPY_ID] = GMTX.onRoomBegin
    extendTable.onRoomClear[CopyDefine.COPY_GMTX_COPY_ID] = GMTX.onRoomClear
    extendTable.onRoomFinish[CopyDefine.COPY_GMTX_COPY_ID] = GMTX.onRoomFinish
    extendTable.onMonsterBeHitCB[CopyDefine.COPY_GMTX_COPY_ID] = GMTX.onMonsterBeHit
    
    --铁骑争锋
    extendTable.onCheckEnterCondition[CopyDefine.COPY_HORSE_FIGHT_ID] = HorseFight.checkEnter
    extendTable.onRoomBegin[CopyDefine.COPY_HORSE_FIGHT_ID] = HorseFight.onHorseFightRoomBegin
    extendTable.onTimerOneSec[CopyDefine.COPY_HORSE_FIGHT_ID] = HorseFight.onHorseFightOneSec
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_HORSE_FIGHT_ID] = HorseFight.onHorseFightHumanEnterCopy

    -- 军团战
    extendTable.onCheckEnterCondition[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.checkEnter
    extendTable.onHumanBeginCopy[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.onFamilyWarHumanBeginCopy
    extendTable.onHumanEndCopy[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.onFamilyWarHumanEndCopy
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.onFamilyWarHumanEnterCopy
    extendTable.onHumanLeaveCopyScene[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.onFamilyWarHumanLeaveCopy
    extendTable.onTimerTenSec[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.onFamilyWarTimer
    extendTable.onTimerOneSec[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.onFamilyWarOneSec
    extendTable.onRoomBegin[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.onFamilyWarRoomBegin
    extendTable.onMonsterDieCB[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.onFamilyWarMonsterDie
    extendTable.onRoleDieCB[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.onFamilyWarRoleDieCB
    extendTable.onRoomClear[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.onFamilyWarRoomClear
    extendTable.onRoomFinish[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.onFamilyWarRoomFinish
    extendTable.onMonsterBeHitCB[CopyDefine.COPY_FAMILYWAR_ID] = FamilyWar.onFamilyWarMonsterBeHitCB

    -- 大汉格斗场
    for i = 419, 424 do
        if i ~= 421 then
            extendTable.onCheckEnterCondition[i] = DHFight.checkEnter
            extendTable.onHumanBeginCopy[i] = DHFight.onDHFightHumanBeginCopy
            extendTable.onHumanEndCopy[i] = DHFight.onDHFightHumanEndCopy
            extendTable.onHumanEnterCopyScene[i] = DHFight.onDHFightHumanEnterCopy
            extendTable.onHumanLeaveCopyScene[i] = DHFight.onDHFightHumanLeaveCopy
            extendTable.onTimerTenSec[i] = DHFight.onDHFightTimer
            extendTable.onTimerOneSec[i] = DHFight.onDHFightOneSec
            extendTable.onRoomBegin[i] = DHFight.onDHFightRoomBegin
            extendTable.onMonsterDieCB[i] = DHFight.onDHFightMonsterDie
            extendTable.onRoleDieCB[i] = DHFight.onDHFightRoleDieCB
            extendTable.onRoomClear[i] = DHFight.onDHFightRoomClear
            extendTable.onRoomFinish[i] = DHFight.onDHFightRoomFinish
            extendTable.onCollectDieCB[i] = DHFight.onCollectDieCB
            extendTable.onRoleBeHitCB[i] = DHFight.onDHFightRoleBeHit
        end
    end
    
    -- TD2(华容突围)
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_TD2_ID] = TD2.onTDHumanEnterCopyScene
    extendTable.onTimerTenSec[CopyDefine.COPY_TD2_ID] = TD2.onTDTimer
    extendTable.onMonsterBeHitCB[CopyDefine.COPY_TD2_ID] = TD2.onMonsterBeHit
    extendTable.onMonsterDieCB[CopyDefine.COPY_TD2_ID] = TD2.onMonsterDie
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_TD2_ID2] = TD2.onTDHumanEnterCopyScene
    extendTable.onTimerTenSec[CopyDefine.COPY_TD2_ID2] = TD2.onTDTimer
    extendTable.onMonsterBeHitCB[CopyDefine.COPY_TD2_ID2] = TD2.onMonsterBeHit
    extendTable.onMonsterDieCB[CopyDefine.COPY_TD2_ID2] = TD2.onMonsterDie

    -- 草船借箭
    extendTable.onCheckEnterCondition[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.checkEnter
    extendTable.onHumanBeginCopy[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCCJJWarHumanBeginCopy
    extendTable.onHumanEndCopy[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCCJJWarHumanEndCopy
    extendTable.onHumanEnterCopyScene[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCCJJWarHumanEnterCopy
    extendTable.onHumanLeaveCopyScene[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCCJJWarHumanLeaveCopy
    extendTable.onTimerTenSec[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCCJJWarTimer
    extendTable.onTimerOneSec[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCCJJWarOneSec
    extendTable.onRoomBegin[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCCJJWarRoomBegin
    extendTable.onMonsterDieCB[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCCJJWarMonsterDie
    extendTable.onRoleDieCB[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCCJJWarRoleDieCB
    extendTable.onRoomClear[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCCJJWarRoomClear
    extendTable.onRoomFinish[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCCJJWarRoomFinish
    extendTable.onCollectDieCB[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCollectDieCB
    extendTable.onRoleBeHitCB[CopyDefine.COPY_CCJJWAR_ID] = CCJJWar.onCCJJWarRoleBeHit
end
init()

function syncWorldCallback(type, copyID, roomID,  param)
    local msg = Msg.lw.LW_COPY_CALLBACK
    msg.type = type
    msg.copyID = copyID
    msg.roomID = roomID
    msg.param = param
    Msg.send2world(msg, "")
end
function onRoomBegin(copyID, roomID)
    Aim.roomBegin(copyID, roomID)

    if extendTable.onRoomBegin[copyID] then
        extendTable.onRoomBegin[copyID](copyID, roomID)
    end

    syncWorldCallback("onRoomBegin", copyID, roomID, "")
end

function onRoomFinish(copyID, roomID, retCode)
    if extendTable.onRoomFinish[copyID] then
        extendTable.onRoomFinish[copyID](copyID, roomID, retCode)
    end
    syncWorldCallback("onRoomFinish", copyID, roomID, ""..retCode)
end

function onRoomFinish2(copyID, roomID)
    if extendTable.onRoomFinish2[copyID] then
        extendTable.onRoomFinish2[copyID](copyID, roomID)
    end
end

function onRoomClear(copyID, roomID)
    Aim.roomClear(copyID, roomID)

    if extendTable.onRoomClear[copyID] then
        extendTable.onRoomClear[copyID](copyID, roomID)
    end
    syncWorldCallback("onRoomClear", copyID, roomID, "")
end

function onHumanBeginCopy(human, copyID, roomID)

    human.db.copyDieCount = 0
    if extendTable.onHumanBeginCopy[copyID] then
        extendTable.onHumanBeginCopy[copyID](human, copyID, roomID)
    end
    CopyFast.checkCanGet(human, copyID)
    ActivityPlay.checkCanGet(human, copyID)
    ComplexActivityPlay.checkCanGet(human, copyID)
    ComplexCopyFast.checkCanGet(human, copyID)

    syncWorldCallback("onHumanBeginCopy", copyID, roomID, human._id)
end

function onHumanEndCopy(human, copyID, roomID)

    if extendTable.onHumanEndCopy[copyID] then
        extendTable.onHumanEndCopy[copyID](human, copyID, roomID)
    end
end

function onHumanEnterCopyScene(human, copyID, roomID, sceneID)
    if extendTable.onHumanEnterCopyScene[copyID] then
        extendTable.onHumanEnterCopyScene[copyID](human, copyID, roomID, sceneID)
    end
    syncWorldCallback("onHumanEnterCopyScene", copyID, roomID, human._id)
    
end

function onHumanLeaveCopyScene(human, copyID, roomID, sceneID)
    if extendTable.onHumanLeaveCopyScene[copyID] then
        extendTable.onHumanLeaveCopyScene[copyID](human, copyID, roomID, sceneID)
    end
    syncWorldCallback("onHumanLeaveCopyScene", copyID, roomID, human._id)
    OfficialLogic.checkOneCondition(human, "enterCopy", copyID)
    OfficialLogic.checkOneCondition(human, "enterAct", copyID)
    if copyID == 9005 then
      OfficialLogic.checkOneCondition(human, "familyCopyTimes")
    end
end

function onMonsterDieCB(killer, monster, monsterID, sumExp)
    local sceneID = monster.scene_id
    local copyID = Copy.sceneID2CopyID[sceneID]
    local roomID = Copy.sceneID2Room[sceneID]
    if copyID == nil or roomID == nil then return end

    Aim.aimMonsterDieCB(killer, monster, monsterID, copyID, roomID)

    if extendTable.onMonsterDieCB[copyID] then
        extendTable.onMonsterDieCB[copyID](killer, monster, monsterID, copyID, roomID, sumExp)
    end
end

function onCollectDieCB(killer, collect, collectID)
    local sceneID = collect.scene_id
    local copyID = Copy.sceneID2CopyID[sceneID]
    local roomID = Copy.sceneID2Room[sceneID]
    if copyID == nil or roomID == nil then return end

    Aim.aimCollectDieCB(killer, collect, collectID, copyID, roomID)

    if extendTable.onCollectDieCB[copyID] then
        extendTable.onCollectDieCB[copyID](killer, collect, collectID, copyID, roomID)
    end
end

function onRoleDieCB(atker, human)
    local sceneID = human.scene_id
    local copyID = Copy.sceneID2CopyID[sceneID]
    local roomID = Copy.sceneID2Room[sceneID]
    if copyID == nil or roomID == nil then return end

    Aim.aimRoleDieCB(human, copyID, roomID)

    if extendTable.onRoleDieCB[copyID] then
        extendTable.onRoleDieCB[copyID](atker, human, copyID, roomID)
    end
end

function onPickUpItemCB(human, itemID, itemCount, item)--, grid)
    local sceneID = human.scene_id
    local copyID = Copy.sceneID2CopyID[sceneID]
    local roomID = Copy.sceneID2Room[sceneID]
    if copyID == nil or roomID == nil then return end

    if CopyExcel[copyID].type == CopyDefine.COPY_TYPE_TEAM or CopyExcel[copyID].type == CopyDefine.COPY_TYPE_COUPLE then
        --		MinimapLogic.onPickUpItemCB(human, copyID, grid)
    end

    if extendTable.onPickUpItemCB[copyID] then
        extendTable.onPickUpItemCB[copyID](human, itemID, itemCount, copyID, roomID, item)
    end
end

function onTimerTenSec(copyID, roomID)
    if extendTable.onTimerTenSec[copyID] then
        extendTable.onTimerTenSec[copyID](copyID, roomID)
    end
end

function onTimerOneSec(copyID, roomID)
    Aim.aimTimerOneSec(copyID, roomID)

    if extendTable.onTimerOneSec[copyID] then
        extendTable.onTimerOneSec[copyID](copyID, roomID)
    end
end

function onRoleOffline(human)
    local sceneID = human.scene_id
    local copyID = Copy.sceneID2CopyID[sceneID]
    local roomID = Copy.sceneID2Room[sceneID]
    if copyID == nil or roomID == nil then return end

    if extendTable.onRoleOffline[copyID] then
        extendTable.onRoleOffline[copyID](human, copyID, roomID)
    end
end

function onSceneNChange(sceneID)
    local copyID = Copy.sceneID2CopyID[sceneID]
    local roomID = Copy.sceneID2Room[sceneID]
    if copyID == nil or roomID == nil then return end

    Aim.aimSceneNChange(copyID, roomID)

    if extendTable.onSceneNChange[copyID] then
        extendTable.onSceneNChange[copyID](copyID, roomID)
    end
end

function canCalcSkillKillCnt(sceneID)
    local copyID = Copy.sceneID2CopyID[sceneID]
    return extendTable.onSkillKillCnt[copyID]
end

function onSkillKillCnt(obj, sceneID, dieCnt, dieMonsterExp)
    local copyID = Copy.sceneID2CopyID[sceneID]
    local roomID = Copy.sceneID2Room[sceneID]
    if copyID == nil or roomID == nil then return end

    if extendTable.onSkillKillCnt[copyID] then
        extendTable.onSkillKillCnt[copyID](obj, copyID, roomID, dieCnt, dieMonsterExp)
    end
end

function onGetLeftTime(copyID, roomID)
    if extendTable.onGetLeftTime[copyID] then
        return extendTable.onGetLeftTime[copyID](copyID, roomID)
    end
end

function onGetFinishReward(copyID, roomID)
    if extendTable.onGetFinishReward[copyID] then
        return extendTable.onGetFinishReward[copyID](copyID, roomID)
    end
end

function onRoleBeHitCB(attacker, human, shanghai)
    if not human or not attacker then
        return
    end
    local sceneID = human.scene_id
    local copyID = Copy.sceneID2CopyID[sceneID]
    if extendTable.onRoleBeHitCB[copyID] then
        return extendTable.onRoleBeHitCB[copyID](attacker, human, shanghai)
    end
end

function onMonsterBeHitCB(attacker, monster, monsterID, shanghai)
    if not monster or not attacker then
        return
    end
    local sceneID = monster.scene_id
    local copyID = Copy.sceneID2CopyID[sceneID]
    local roomID = Copy.sceneID2Room[sceneID]
    if extendTable.onMonsterBeHitCB[copyID] then
        return extendTable.onMonsterBeHitCB[copyID](attacker, monster, monsterID, shanghai, copyID, roomID, sceneID)
    end
end

function onActionAddExp(human, sceneID, exp)
    local copyID = Copy.sceneID2CopyID[sceneID]
    local roomID = Copy.sceneID2Room[sceneID]
    if copyID == nil or roomID == nil then return end

    if extendTable.onActionAddExp[copyID] then
        return extendTable.onActionAddExp[copyID](human, exp)
    end
end


function onDoAimFinish(copyID, roomID, aimID)
    local t = extendTable.onDoAimFinish[copyID]
    if t then
        return extendTable.onDoAimFinish[copyID](copyID, roomID, aimID)
    end
end

function onCheckEnterCondition(human, copyID)
    local t = extendTable.onCheckEnterCondition[copyID]
    if t then
        return t(human, copyID)
    end
    return true
end
